<template>
	<view class="w-100">
		<view class="video-box ">
			<video id="myVideo" :src="curriculumDetail.video_url"
				 controls></video>
			<view class="flex-1 mx-3 mt-2">
				<view class="font-s-4 font-w">{{ curriculumDetail.curriculum_name }}</view>
				<view class="row-ac-sb font-s-2 text-muted mt-2">
					<view>讲师:{{ curriculumDetail.lecturer_name }}</view>
					<view>{{ curriculumDetail.create_time }}</view>
				</view>
			</view>
			<view class="flex-1 d-f justify-end mt-2">
				<view class="row-ac mr-3">
					<view class="iconfont icon-knowledge mr-2"></view>
					<view class="font-s-3">课件</view>
				</view>
			</view>
		</view>
		<!-- <view class="flex-1 mx-3 row-ac-sb mt-3">
			<view>评论</view>
			<view class="font-s-2 text-muted">0</view>
		</view> -->
		<!-- <view style="height: 100rpx;" class="fixed-bottom flex-1 border-top bg-white row-ac">

			<input type="text" v-model="content" class="flex-1 rounded bg-light ml-3 p-2 mr-2" :focus="focus"
				placeholder="文明发言" @confirm="submit" @blur="blur" />

			<view class="font-s-4 mr-3" @click="submit">发送</view>

		</view> -->
	</view>
</template>

<script>
	import { curriculumDetailUrl } from "@/api/index.js"
	export default {
		data() {
			return {
				src: '',
				content: '',
				focus: false,
				getCurriculumId:'',
				curriculumDetail:''
			}
		},
		onReady: function(res) {
			// #ifndef MP-ALIPAY
			this.videoContext = uni.createVideoContext('myVideo')
			// #endif
		},
		onLoad(options) {
			this.getCurriculumId = options.curriculumId
			this.getCurriculumDetail()
		},
		methods: {
			getCurriculumDetail(){
				this.$R.get(curriculumDetailUrl + this.getCurriculumId + '/').then(res=>{
					if(res.code == 200){
						this.curriculumDetail = res.data
						console.log(this.curriculumDetail);
					}
				})
			},
			videoErrorCallback: function(e) {
				uni.showModal({
					content: e.target.errMsg,
					showCancel: false
				})
			},
			getRandomColor: function() {
				const rgb = []
				for (let i = 0; i < 3; ++i) {
					let color = Math.floor(Math.random() * 256).toString(16)
					color = color.length == 1 ? '0' + color : color
					rgb.push(color)
				}
				return '#' + rgb.join('')
			},
			submit() {

			},
			blur() {
				// this.reply_id = 0
				this.focus = false
			}
		}
	}
</script>


<style lang="scss">
	.video-box {
		width: 100%;

		video {
			width: 100%;
			height: 438rpx;
		}
	}
</style>